1. Field of the Invention
This invention relates to an image processing method and apparatus. For example, the invention relates to an image processing apparatus method for coding an image upon dividing the image into areas, and an image processing apparatus and method for recognizing a background area from image data.
2. Description of the Related Art
The rapid progress that has been made in image coding techniques in recent years has been accompanied by progress in international standardization. The JPEG (Joint Photographic Experts Group) scheme has been adopted as the standard for non-reversible coding of multivalued color images, and the JBIG (Joint Bi-level Image Group) scheme has been adopted as the standard for reversible coding of monochromatic bi-level images. The standardization of new coding methods is proceeding.
FIG. 1 is a block diagram showing the architecture of an image coding apparatus. The apparatus includes a scanner 1001 for entering an image, a selector 1002 for selecting the destination of the input image in accordance with a command entered by the user, a JPEG coder 1003 for coding the input image according to the JPEG standard, a binarizer 1004 for binarizing the input image, a JBIG coder 1005 for coding the bi-level image from the binarizer 1004, a selector 1006 for selecting the source of an input code in accordance with a command entered by the user, a communication interface 1007 and a communication line 1008 such as a telephone line or LAN. It should be noted that the selectors 1002 and 1006 operate in synchronism so that the image coded via the selector 1002 will be sent to the communication interface 1007 via the selector 1006.
When the user wishes to transmit a color image using this apparatus, the JPEG coder 1003 is selected as the destination of the output from the selector 1002 and as the source of the input to the selector 1006. Next, the scanner 1001 is operated to enter the image data, and the image data are entered into the JPEG coder 1003 via the selector 1002, whereby code data coded according to the JPEG standard are obtained. These code data are entered into the communication interface 1007 via the selector 1006, after which the data are sent to the communication line 1008 by the communication interface 1007 in accordance with a predetermined protocol.
When the user wishes to transmit a monochromatic bi-level image using this apparatus, the binarizer 1004 is selected as the destination of the output from the selector 1002 and the JBIG coder 1005 is selected as the source of the input to the selector 1006. Next, the scanner 1001 is operated to enter the image data, and the image data are entered into the binarizer 1004 via the selector 1002. The binarizer 1004 compares the entered image data with a preset threshold value to binarize the image data. The binarized image data enter the JBIG coder 1005, whereby the data are converted to code data in accordance with the JBIG standard. These code data are entered into the communication interface 1007 via the selector 1006, after which the data are sent to the communication line 1008 by the communication interface 1007 in accordance with a predetermined protocol.
However, the technique described above has certain shortcomings. Specifically, in the above-described image coding apparatus in which the coding method is changed over on an image-by-image basis, characters and line-image portions contained in an image are subjected to multivalued coding as by the JPEG scheme. As a consequence, edges, which are the characterizing features of a character or line drawing, become blurred. This results in a decline in the quality of the appearance of the characters and line drawings. Further, when bi-level binarization is performed according to the JBIG standard, grayscale portions contained in the image are flattened by binarization.
According to a proposed improvement in the JPEG standard, the features of an image are judged on a coding unit basis (i.e., in blocks of 8.times.8 pixels) and either the quantization coefficient or the coding table is changed over (see U.S. application Ser. No. 736,740, filed on Jul. 26, 1991). With this method, however, referential pixels for judging the features of an image are too few to obtain correct results.
It has also been contemplated to change over the coding scheme upon judging image areas in large zones using a method of binarizing a multivalued image to separate the image into areas such as character/line-image areas and photographic areas (see U.S. application Ser. No. 524,409, filed on Sep. 6, 1995). However, with a method of extracting image areas whose density is greater than a predetermined density using a fixed or variable threshold value, it is not possible to accommodate low-contrast characters and line drawings or outline characters.
Furthermore, when a multivalued image is binarized and the edge of a character or line drawing is indistinct at the start, the binarized image develops thickening that can cause judgment errors when the image is-separated into areas. In particular, when there is no longer white space between characters and a character area is erroneously judged to be a grayscale area, character/line-drawing areas undergo multivalued coding. This problem is similar to that encountered with the image coding apparatus, which changes over the coding method on an image-by-image basis.
Recent progress in the development of image processing apparatus has been accompanied by proposals relating to an image processing apparatus having an image-area partitioning function according to which a multivalued image containing character areas and pattern areas is divided into areas conforming to the features of the areas and the coding method is changed over area by area to improve the efficiency of coding, or according to which areas containing characters are extracted and the characters are read optically (generally referred to as "OCR").
As described in the specifications of Japanese Patent Application Laid-Open No. 62-226770 (entitled "Image Area Discriminating Apparatus") and Japanese Patent Application Laid-Open No. 3-126181 (entitled "Method of Partitioning Document Image into Areas"), for example, image processing apparatus which execute image-area partitioning processing are mostly apparatus which binarize a multivalued image in dependence upon a predetermined threshold value and discriminate whether an area is a character area, photographic area or table, etc., based upon the bi-level image. Further, as described in the specification of Japanese Patent Application Laid-Open No. 4-248766 (entitled "Image Area Separation"), for example, a method has been proposed in which an image is separated into character areas and pattern areas using background as a "white" area.
Further, the recent rapid popularity of DTP has been accompanied by increasing diversification of documents and other images, and methods of performing area partitioning processing are not limited to that mentioned above but are themselves becoming increasingly diverse.
However, processing for partitioning image areas in the above-described image processing apparatus largely entails subjecting a multivalued image to binarization processing. When such binarization processing is executed, the entire image is binarized at a fixed threshold value without taking the density of the image background into consideration. Depending upon the background color, therefore, appropriate binarization is not always carried out and the results of area partitioning can develop an error. This means that it is not possible to deal suitably with a document printed on paper whose background is colored or exhibits a density other than white.
The fact that the above-described processing for partitioning image areas binarizes the entire image at a single threshold value leads to other problems as well. For example, when each cell in a table is given meaning as by changing its density or color, or when the ruled lines of a table are deleted as by changing the density or color of rows or columns, the differences in density or color are ignored, the cells of the table can no longer be recognized.
Though a technique for separating the background portion from a color image has been proposed in the specification of U.S. application Ser. No. 08/579,358, filed on Dec. 27, 1995, there is still room for improvement.